//
//  GWTableViewCell.m
//  壳牌喜力促销积分商城
//
//  Created by xrd on 15/3/15.
//  Copyright (c) 2015年 xrd. All rights reserved.
//

#import "GWTableViewCell.h"
#import "GoodsModel.h"
@interface GWTableViewCell()
- (IBAction)checkBtnClick:(UIButton *)sender;

@end
@implementation GWTableViewCell



-(void)setGoods:(GoodsModel *)goods{
    //更新数据
    _goods = goods;
    _iconView.image = [UIImage imageNamed:_goods.icon];
    _nameLable.text = _goods.name;
    _scoreLable.text = [NSString stringWithFormat:@"%d点积分",_goods.scores];
    _scoreLable.textColor = [UIColor redColor];
    //记录按钮状态
    _checkBtn.selected = _goods.isSelected;
    
    
}

//+(instancetype)tableViewCellWithTabelView:(UITableView *)tableView
//{
//static NSString *ID = @"GWCell";
//    GWTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
////      GWTableViewCell *cell = [tableView
//
//    if (cell == nil) {
//        cell = [[[NSBundle mainBundle]loadNibNamed:@"GWTableViewCell"owner:nil options:nil]lastObject];
//        
//    }
//
//    return cell;
//    
//}

- (void)awakeFromNib {
    // Initialization code
}

//- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
//    [super setSelected:selected animated:animated];
//
//    // Configure the view for the selected state
//}

//self.checkBoxSelect.selected = NO;
//sender.selected = !sender.selected;
//self.checkBoxSelect = sender;
- (IBAction)checkBtnClick:(UIButton *)sender {
    sender.selected = !sender.selected;
    _goods.selected = sender.selected;
}
@end
